package com.bs.medicine.utils;

import com.bs.entity.User;
import com.bs.medicine.struts.action.LoginAction;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class LoginInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation au) throws Exception {
		
			if(LoginAction.class == au.getAction().getClass()){
				return au.invoke();
			}
			//对未登录进行拦截
			if(null == au.getInvocationContext().getSession().get("user")){
				return Action.LOGIN;
			}else {
			User user =(User)au.getInvocationContext().getSession().get("user");
			System.out.println("0000000000000000");
			return au.invoke();
			}
			
		}

	

}
